﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" 
    xmlns:local="clr-namespace:Omnia.UX" xmlns:Converters="clr-namespace:Omnia.Converters;assembly=Omnia.Converters">
    <Converters:StringToPathGeometryConverter x:Key="StringToPathGeometryConverter"/>

    <Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

    <Style TargetType="local:UXHomeItem">
        <Setter Property="Margin" Value="12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXHomeItem">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="60"/>
                            <ColumnDefinition Width="24"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid Height="60" Background="{StaticResource PhoneAccentBrush}" VerticalAlignment="Top">
                            <Path VerticalAlignment="Center" Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" Stretch="Uniform" Margin="12" RenderTransformOrigin="0.5,0.5" Name="el" Fill="White">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="0" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <es:RegularPolygon Grid.Column="1" PointCount="3" HorizontalAlignment="Right" Height="20" StrokeThickness="0" Fill="{StaticResource PhoneSubtleBrush}" VerticalAlignment="Top" Width="40" Margin="0,6,-20,0" RenderTransformOrigin="0.5,0.5">
                            <es:RegularPolygon.RenderTransform>
                                <CompositeTransform ScaleY="-1"/>
                            </es:RegularPolygon.RenderTransform>
                            <es:RegularPolygon.Clip>
                                <RectangleGeometry Rect="0,0,20,30"/>
                            </es:RegularPolygon.Clip>
                        </es:RegularPolygon>
                        <Grid Grid.Column="2" Background="{StaticResource PhoneSubtleBrush}" MinHeight="80">
                            <ContentPresenter Content="{TemplateBinding Content}"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXHomeTitle">
        <Setter Property="Margin" Value="12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXHomeTitle">
                    <Grid Height="60">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="60"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid Width="60">
                            <Ellipse Fill="{StaticResource PhoneAccentBrush}"/>
                            <Path VerticalAlignment="Center" Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" Stretch="Uniform" Margin="12" RenderTransformOrigin="0.5,0.5" Name="el" Fill="White">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="0" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <Border Height="40" Grid.ColumnSpan="2" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" CornerRadius="20"/>
                        <ContentPresenter Content="{TemplateBinding Content}" VerticalAlignment="Center" Margin="12,0" Grid.Column="1"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXRadioButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXRadioButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Normal" />
                                
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="el"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="26"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Path VerticalAlignment="Center" Data="M0,0L53.333,0 53.333,8.888 0,8.888z" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Width="26" Height="26" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" Name="el">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <TransformGroup.Children>
                                        <RotateTransform Angle="0" />
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </TransformGroup.Children>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <Path VerticalAlignment="Center" Data="F1M574.042,314.611L533.8,344.398 522.251,328.798 515.235,333.988 526.786,349.593 526.782,349.596 531.978,356.603 579.235,321.622 574.042,314.611z" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Width="26" Height="26" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <RotateTransform Angle="0" />
                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <Grid Background="White" Opacity="0" Grid.ColumnSpan="2"/>
                        <ContentPresenter
                              Grid.Column="1"
                              x:Name="contentPresenter"
                              Content="{TemplateBinding Content}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                              Margin="{TemplateBinding Padding}"/>
                        <!--<TextBlock Style="{StaticResource PhoneTextTitle3Style}" Text="{TemplateBinding Content}" Grid.Column="1" Foreground="{TemplateBinding Foreground}"/>-->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXLinkMenu">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXLinkMenu">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled"/>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="text"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock Name="text" Style="{StaticResource PhoneTextTitle2Style}" Text="{TemplateBinding Content}" Margin="12,6"/>    
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:UXPathButton">
        <Setter Property="Width" Value="48"/>
        <Setter Property="Height" Value="48"/>
        <Setter Property="Padding" Value="12"/>
        <Setter Property="BorderThickness" Value="3"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXPathButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        
                        <Grid Name="normalGrid" Opacity="1">
                            <Ellipse Stroke="{TemplateBinding Foreground}" 
                                     StrokeThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StrokeThickness}"/>
                            <Path VerticalAlignment="Center" 
                                  Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Name="el" Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="pressedGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXPathButtonWithUriAndParameter">
        <Setter Property="Width" Value="48"/>
        <Setter Property="Height" Value="48"/>
        <Setter Property="Padding" Value="12"/>
        <Setter Property="BorderThickness" Value="3"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXPathButtonWithUriAndParameter">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Name="normalGrid" Opacity="1">
                            <Ellipse Stroke="{TemplateBinding Foreground}" 
                                     StrokeThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StrokeThickness}"/>
                            <Path VerticalAlignment="Center" 
                                  Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Name="el" Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="pressedGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXHyperLink">
        <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXHyperLink">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled"/>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="text"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock Name="text" Style="{StaticResource PhoneTextNormalStyle}" Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground }"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>